package edu.sctu.zhengsenwen.month201506.day20150624;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * Created by user15 on 2015/6/26.
 */
public class MyGame extends Frame {  //awt swing


    Image image = GameUtil.getImage("C://Users//user15//Desktop//dog.jpg");

    public void lunchFrame(){
        setSize(400,400);
        setLocation(300,300);
        setVisible(true);

        new Thread(new PaintThread()).start();

        GameUtil gameUtil = new GameUtil();

        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }

    public void paint(Graphics graphics){
        graphics.drawLine(100,100,200,200);
        graphics.drawRect(100,100,200,200);
        graphics.drawOval(100,100,200,200);

        Font font = new Font("宋体",Font.BOLD,10);

        graphics.setFont(font);
        Color color = graphics.getColor();
        graphics.setColor(Color.red);
        graphics.drawString("我是小黑马郑森文",200,200);
        graphics.drawRect(10,10,20,20);
        graphics.drawOval(10,10,20,20);

        graphics.setColor(color);

    }


    public static void main(String[] args) {

        MyGame myGame = new MyGame();
        myGame.lunchFrame();
    }
}
